
<?php

include 'Snoopy.class.php';
$url = "http://www.baidu.com/s?wd=a&pn=20";
//$snoopy = new Snoopy;
//$snoopy->fetchlinks($url);
//
//
//
//
//foreach ($snoopy->results as $test) {
//
//    preg_match("|$url\/.*\/|", $test, $matches);
//    foreach($matches as $flurl)
//    {
//        echo $flurl[0]. "\n";
//    }
//}
//
//<?php    
  

$snoopy = new Snoopy;

$snoopy->fetchlinks($url);

$allurl = $snoopy->results;

//print("var_dump($allurl)")or die;
$clearUrls = array();
//去重操作   
foreach ($allurl as $value) {
    if (!(in_array($value, $clearUrls))) {
        $clearUrls[] = $value;
    }
}

foreach ($clearUrls as $value) {
    echo $value . "\n";
}




//www.baidu.com/s?wd=a&pn=20